package midterm;

import java.util.LinkedList;
import java.util.List;
import java.util.Random;

public class demo1 {
    public static void main(String[] args) {
        Random r = new Random();
        List<Integer> list = new LinkedList<>();
        //存储元素
        list.add(0);
        for (int i = 1; i <= 100; i++){
            list.add(r.nextInt(200) + 1);
        }
        //删除元素
        while(list.size() != 2){
            for (int i = 1; i < list.size(); i+=2){
                list.remove(i);
            }
        }
        System.out.println(list);
        System.out.println(list.get(1));

    }
}
